#include <iostream>
#include <stdio.h>
#include <vector>
#include "string.h"
using namespace std;

int search(int* nums, int numsSize, int target){
    int l=0,r=numsSize-1;
    while(l<r){
        int mid=l+r>>1;
        if(target<=nums[mid]){
            r=mid;
        }else{
            l=mid+1;
        }
    }
    if(nums[l]==target){
        return l;
    }else{
        return -1;
    }
}

class Solution {
public:
    int longestCommonSubsequence(string text1, string text2) {
        vector<vector<int>> dp(text1.size() + 1, vector<int>(text2.size() + 1, 0));
        for(int i=1;i<=text1.size();i++){
            for(int j=1;j<=text2.size();j++){
                if(text1[i-1]==text2[j-1]){
                    dp[i][j]=dp[i-1][j-1]+1;
                }else{
                    dp[i][j]=max(dp[i-1][j],dp[i][j-1]);
                }
            }
        }
        return dp[text1.size()][text2.size()];
    }
};

int main() {
    int arr[6]={-1,0,3,5,9,12};
    int ans=search(arr,sizeof(arr)/sizeof(int),9);
    cout << ans << endl;
    printf("hello world");
    return 0;
}
